import request from '@/utils/request'

// 获取模型配置
export const getModelConfig = () => {
  return request({
    url: '/api/model/config',
    method: 'get'
  })
}

// 更新模型配置
export const updateModelConfig = (config) => {
  return request({
    url: '/api/model/config',
    method: 'put',
    data: config
  })
}

// 获取可用模型列表
export const listModels = () => {
  return request({
    url: '/api/model/list',
    method: 'get'
  })
}

// 获取模型状态
export const getModelStatus = () => {
  return request({
    url: '/api/model/status',
    method: 'get'
  })
}

// 测试连接
export const testOllamaConnection = (endpoint) => {
  return request({
    url: '/api/model/test',
    method: 'post',
    data: { endpoint },
    timeout: 5000
  })
}

// 拉取模型
export const pullModel = (name) => {
  return request({
    url: '/api/model/pull',
    method: 'post',
    data: { name }
  })
}